package com.library.service.impl;

import java.util.HashMap;
import java.util.Map;

import com.library.bean.Admin;
import com.library.dao.AdminDao;
import com.library.dao.impl.AdminDaoImpl;
import com.library.service.AdminService;

public class AdminServiceImpl implements AdminService {
	private AdminDao adminDao = new AdminDaoImpl();

	@Override
	public Map<String, Object> loginAdmin(String adminName, String passWord) {
		Map<String, Object> map = new HashMap<String, Object>();
		Admin admin = adminDao.selectAdmin(adminName, passWord);
		if(admin!=null) {//登录成功
			map.put("loginAdmin", admin);
		}else {//登录失败
			admin = adminDao.selectAdminByadminName(adminName);
			if(admin!=null) {//账号存在则密码错误
				map.put("msg", "密码错误");
			}else {//账号不存在
				map.put("msg", "账号不存在");
			}
		}
		return map;
	}

}
